netlitlibrary(knitr)literature_metadata %>%
filter(is.na(author_gender) | is.na(author_h_index)| is.na(author_citations)) %>%
kable()| id | author | year | publication | title | citations | outside_u_s | author_gender | author_h_index | author_citations |
|---|---|---|---|---|---|---|---|---|---|
| Wildgen & Engstrom 1980 | Wildgen & Engstrom | 1980 | Legislative Studies Quarterly | Spatial Distribution of Partisan Support and the Seats/Votes Relationship | 30 | NA | NA | NA | NA |
| Buchler 2005 | Buchler | 2005 | Journal of Theoretical Politics | Competition, Representation and Redistricting: The Case Against Competitive Congressional Districts | 81 | NA | M | NA | NA |
| Glazer et al. 1987 | Glazer et al. | 1987 | AJPS | Partisan and Incumbency Effects of 1970s Congressional Redistricting | 102 | NA | NA | NA | NA |
| Gay 2007 | Gay | 2007 | JOP | Legislating Without Constraints: The Effect of Minority Districting on Legislators’ Responsiveness to Constituency Preferences | 47 | NA | F | NA | NA |
| Bratton & Haynie 1999 | Bratton & Haynie | 1999 | JOP | Agenda Setting and Legislative Success in State Legislatures: The Effects of Gender and Race | 740 | NA | F | NA | NA |
| Wyrick 1991 | Wyrick | 1991 | American Politics Quarterly | Management of Political Influence: Gerrymandering in the 1980s | 10 | NA | M | NA | NA |
| Bullock 1995 | Bullock | 1995 | American Politics Quarterly | The Impact of Changing the Racial Composition of Congressional Districts on Legislators’ Roll Call Behavior | 63 | NA | M | NA | NA |
| Overby & Cosgrove 1996 | Overby & Cosgrove | 1996 | JOP | Unintended Consequences? Racial Redistricting and the Representation of Minority Interests | 164 | NA | M | NA | NA |
| Sharpe & Garand 2001 | Sharpe & Garand | 2001 | Political Research Quarterly | Race, Roll Calls, and Redistricting: The Impact of Race-Based Redistricting on Congressional Roll-Call | 48 | NA | M | NA | NA |
| LeVeaux & Garand 2003 | LeVeaux & Garand | 2003 | Social Science Quarterly | Race‐Based Redistricting, Core Constituencies, and Legislative Responsiveness to Constituency Change* | 13 | NA | F | NA | NA |
| Lyons & Galderisi 1995 | Lyons & Galderisi | 1995 | Political Research Quarterly | Incumbency, Reapportionment, and US House Redistricting | 43 | NA | M | NA | NA |
| Hirsch 2003 | Hirsch | 2003 | Election Law Journal | The United States House of Unrepresentatives: What Went Wrong in the Latest Round of Congressional Redistricting | 159 | NA | NA | NA | NA |
| Forgette & Winkle 2006 | Forgette & Winkle | 2006 | Social Science Quarterly | Partisan Gerrymandering and the Voting Rights Act | 16 | NA | M | NA | NA |
| Forgette & Platt 2005 | Forgette & Platt | 2005 | Political Geography | Redistricting Principles and Incumbency Protection in the US Congress | 33 | NA | M | NA | NA |
| Wong 2019 | Wong | 2019 | BJPS | Gerrymandering in Electoral Autocracies: Evidence from Hong Kong | 16 | 1 | NA | 11 | 454 |
library(ggraph)lit <- literature_long %>%
distinct(to, from) %>%
review()
lit## A netlit_review object with the following components:
##
## $edgelist
## - 69 edges
## - edge attributes: edge_betweenness
## $nodelist
## - 56 nodes
## - node attributes: degree_in, degree_out, degree_total, betweenness
## $graph
## an igraph object
# best seed 1,4, *5*
set.seed(5)
netlit_plot <- function(g){
ggraph(g, layout = 'fr') +
geom_node_point(
aes(color = degree_total %>% as.factor() ),
size = 6,
alpha = .7
) +
geom_edge_arc2(
aes(
start_cap = circle(3, 'mm'),
end_cap = circle(6, 'mm'),
color = edge_betweenness,
),
curvature = 0,
arrow = arrow(length = unit(2, 'mm'),
type = "open")
) +
geom_edge_loop(
aes( color = edge_betweenness,
start_cap = circle(5, 'mm'),
end_cap = circle(2, 'mm'),
),
n = 300,
strength = .6,
arrow = arrow(length = unit(2, 'mm'),
type = "open")
) +
geom_node_text( aes(label = name), size = 2.3) +
ggplot2::theme_void() +
theme(legend.position="bottom") +
labs(edge_color = "Edge Betweenness",
color = "Total Degree\nCentrality",
edge_linetype = "") +
scale_edge_color_viridis(discrete = FALSE,
option = "plasma",
begin = 0,
end = .9,
direction = -1) +
scale_color_viridis_d(option = "mako",
begin = 1,
end = .5)
}
literature_long %>%
distinct(to, from) %>%
review() %>%
.$graph %>%
netlit_plot()literature_long %<>%
mutate(author_is_man = author_gender == "M")
bro_lit <- literature_long %>%
filter(author_is_man) %>%
distinct(to, from) %>%
review()
bro_lit## A netlit_review object with the following components:
##
## $edgelist
## - 61 edges
## - edge attributes: edge_betweenness
## $nodelist
## - 52 nodes
## - node attributes: degree_in, degree_out, degree_total, betweenness
## $graph
## an igraph object
literature_long %>%
filter(author_is_man) %>%
distinct(to, from) %>%
review() %>%
.$graph %>%
netlit_plot()Nodes missing: Instability, Legislative Outcomes, Personal Vote, Efficiency Principle
# biased sample weights
literature_long %<>%
mutate(unbiased = .5,
weight = case_when(
author_is_man ~ .6,
!author_is_man ~ .4,
TRUE~ .5
))
# a function to sample the network
sample_lit <- function(n, literature_long, prob){
# create index for sample
samp_idx <- sample(seq_len(nrow(literature_long)),
100, # 100 draws = number of studies to draw
prob=prob # with prob var provided
)
# subset sample to index
sample <- literature_long %>%
rowid_to_column() %>%
filter(rowid %in% samp_idx) %>%
distinct(to, from) %>%
review()
return(sample)
}
# TEST
# random_samples <- sample_lit(literature_long, prob = literature_long$unbiased)
# gender_samples <- sample_lit(literature_long, prob = literature_long$weight)random_samples <- map(1:100, # 100 samples
sample_lit,
literature_long=literature_long,
prob = literature_long$unbiased)
# make table of total number of nodes, edges and the graph object for plotting
random <- tibble(
nodes = random_samples %>% map(1) %>% modify(nrow) %>% unlist(),
edges = random_samples %>% map(2) %>% modify(nrow) %>% unlist(),
graph = random_samples %>% map(3),
sample = "Random"
)
# map(random$graph, netlit_plot)Average nodes recovered: 46.32
Average edges recovered: 43.85
# gender biased samples
gender_samples <- map(1:100, sample_lit,literature_long=literature_long, prob = literature_long$weight)
gender <- tibble(
nodes = gender_samples %>% map(1) %>% modify(nrow) %>% unlist(),
edges = gender_samples %>% map(2) %>% modify(nrow) %>% unlist(),
graph = gender_samples %>% map(3),
sample = "Gender bias favoring men"
)
#map(gender$graph, netlit_plot)Average nodes recovered: 47.17
Average edges recovered: 44.5
# biased sample weights
literature_long %<>%
mutate(weight = case_when(
author_is_man ~ 1,
!author_is_man ~ .3,
TRUE~ .5
))
# gender biased samples
gender_samples <- map(1:100, sample_lit,literature_long=literature_long, prob = literature_long$weight)
gender <- tibble(
nodes = gender_samples %>% map(1) %>% modify(nrow) %>% unlist(),
edges = gender_samples %>% map(2) %>% modify(nrow) %>% unlist(),
graph = gender_samples %>% map(3),
sample = "Gender bias favoring men"
)
#map(gender$graph, netlit_plot)Average nodes recovered: 49.38
Average edges recovered: 45.62
# biased sample weights
literature_long %<>%
mutate(weight = case_when(
author_is_man ~ .3,
!author_is_man ~ 1,
TRUE~ .5
))
# gender biased samples
gender_samples2 <- map(1:100, sample_lit,literature_long=literature_long, prob = literature_long$weight)
gender2 <- tibble(
nodes = gender_samples %>% map(1) %>% modify(nrow) %>% unlist(),
edges = gender_samples %>% map(2) %>% modify(nrow) %>% unlist(),
graph = gender_samples %>% map(3),
sample = "Gender bias favoring women"
)
#map(gender$graph, netlit_plot)Average nodes recovered: 49.38
Average edges recovered: 45.62
(replacing NA HIndex with 0)
literature_long %<>%
mutate(author_h_index = replace_na(author_h_index, 0 ))
# gender biased samples
hindex_samples <- map(1:100, sample_lit,literature_long=literature_long, prob = literature_long$author_h_index)
hindex <- tibble(
nodes = hindex_samples %>% map(1) %>% modify(nrow) %>% unlist(),
edges = hindex_samples %>% map(2) %>% modify(nrow) %>% unlist(),
graph = hindex_samples %>% map(3),
sample = "H-Index bias"
)
#map(gender$graph, netlit_plot)Average nodes recovered: 51.74
Average edges recovered: 47.28
literature_long %<>%
mutate(author_citations = replace_na(author_citations, 0 ))
# gender biased samples
citations_samples <- map(1:100, sample_lit,literature_long=literature_long, prob = literature_long$author_citations)
citations <- tibble(
nodes = citations_samples %>% map(1) %>% modify(nrow) %>% unlist(),
edges = citations_samples %>% map(2) %>% modify(nrow) %>% unlist(),
graph = citations_samples %>% map(3),
sample = "Citations bias"
)
# map(citations$graph, netlit_plot)Average nodes recovered: 51.94
Average edges recovered: 46.88
s <- full_join(random, gender) %>%
full_join(hindex) %>%
full_join(citations)
s %>%
ggplot() +
aes(x = nodes, fill = sample, color = sample) +
geom_density(alpha = .5) +
scale_color_viridis_d() +
scale_fill_viridis_d() +
theme_minimal() +
labs(color = "",
fill = "") +
theme(axis.text.y = element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank())
s %>%
ggplot() +
aes(x = edges, fill = sample, color = sample) +
geom_density(alpha = .5) +
scale_color_viridis_d() +
scale_fill_viridis_d() +
theme_minimal() +
labs(color = "",
fill = "") +
theme(axis.text.y = element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank())